home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / Xprof / xprof / profile.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  6KB  |  199 lines

  1. /*==================================================================
  2.  *      File :          profile.h
  3.  *      Package:        Xprof
  4.  *
  5.  *      Author :        Aloke Gupta.
  6.  *
  7.  *  (C) Copyright 1992, Aloke Gupta.
  8.  *==================================================================*/
  9.  
  10. /* Declarations for the profiler code.  */
  11.  
  12. #ifndef _PROFILE_H_
  13. #define _PROFILE_H_
  14.  
  15. #include <X11/Xlib.h>
  16. typedef enum {
  17.     INSTALL, NOINSTALL
  18. } Install;
  19.  
  20. typedef enum {
  21.     VALID = 0, INVALID = -1
  22. } Valid;
  23.  
  24. double get_net_latency() ;
  25. double get_net_speed()   ;
  26. float get_request_time(/*int index, Xattributes *attributes */);
  27.  
  28. /* Each request has one instance of the following data structure.
  29.  * Depending on the msgclass of the request, the relevant member of the
  30.  * union is chosen to hang the cost list of the requests.
  31.  */
  32. typedef union _MsgCost {
  33.     struct _CostCell *win;    /* Points to list of costs */
  34.     struct _GfxCost  *gfx;    /* Array of GfxCost */
  35.     struct _TxtCost  *txt;      /* Array of TxtCost */
  36. } MsgCost;
  37.  
  38. typedef struct _CostCell {
  39.     float    size;        /* Size for which this measurement was made ?*/
  40.     float    speed;        /* Speed in size units per second ? */
  41.     struct _CostCell *nextcost;    /* Next data point for size and speed thereof*/
  42. } CostCell;
  43.  
  44. typedef struct _GfxCost {
  45.     CostCell *costlist;
  46. } GfxCost;
  47.  
  48. typedef struct _TxtCost {
  49.     CostCell *costlist;
  50. } TxtCost;
  51.  
  52. /*
  53.  * The following defines are intimately related to the indices of the entries
  54.  * in the GxmodeTable structure array defined in gc.c
  55.  */
  56. #define GXCLEAR         0
  57. #define GXAND           1
  58. #define GXANDREVERSE    2
  59. #define GXCOPY          3
  60. #define GXANDINVERTED   4
  61. #define GXNOOP          5
  62. #define GXXOR           6
  63. #define GXOR            7
  64. #define GXNOR           8
  65. #define GXEQUIV         9
  66. #define GXINVERT       10
  67. #define GXORREVERSE    11
  68. #define GXCOPYINVERTED 12
  69. #define GXORINVERTED   13
  70. #define GXNAND         14
  71. #define GXSET          15
  72.  
  73. /* The following is defined in gc.c as the sizeof GxmodeTable */
  74. extern unsigned int MAXGXMODES;
  75.  
  76. /*
  77.  * The following defines are intimately related to the indices of the entries
  78.  * in the LineStyleTable structure array defined in gc.c
  79.  */
  80. #define LINESOLID      0
  81. #define LINEONOFFDASH  1
  82. #define LINEDOUBLEDASH 2
  83.  
  84. /* The following is defined in gc.c as the sizeof GxmodeTable */
  85. extern unsigned int MAXLINESTYLES;
  86.  
  87. /*
  88.  * The following defines are intimately related to the indices of the entries
  89.  * in the LineStyleTable structure array defined in gc.c
  90.  */
  91. #define FILLSOLID          0
  92. #define FILLOPAQUESTIPPLED 1
  93. #define FILLSTIPPLED       2
  94. #define FILLTILED          3
  95.  
  96. /* The following is defined in gc.c as the sizeof GxmodeTable */
  97. extern unsigned int MAXFILLSTYLES;
  98.  
  99. /*
  100.  * Instances of the following structure are used to manage the mappings of
  101.  * attributes in Xprof. Not all attributes are actually present in the 
  102.  * performance metrics supplied by Xmeasure. The ones not present are simulated
  103.  * by other ones as decided by the entry "where" in the structure below.
  104.  */
  105. typedef struct _AttributesTable {
  106.     int index;        /* This should be  equal to the actual array index */
  107.     char *xprof_name;    /* Name of this attribute as used in the Xprof package*/
  108.     char *xscope_name;    /* Name of this attribtue as used in Xscope */
  109.     int  where;        /* Which index contains actual value of this attribute*/
  110.     int  value;        /* Actual value. (-1) if meaningless */
  111. } AttributesTable;
  112.  
  113. #define XPROF_GXMODES    2
  114. #define XPROF_LINESTYLES    2
  115. #define XPROF_FILLSTYLES    2
  116. #define XPROF_LINEWIDTHS    4
  117.  
  118. #define MASK2    0x01
  119. #define MASK4    0x03
  120.  
  121. #define GFXSLOTS (XPROF_GXMODES * XPROF_LINESTYLES * XPROF_FILLSTYLES * XPROF_LINEWIDTHS)
  122.  
  123. #define GFXINDEX(gxmode, linestyle, fillstyle, linewidth) ( \
  124.  ((gxmode    & MASK2)     ) |   \
  125.  ((linestyle & MASK2) << 1) |   \
  126.  ((fillstyle & MASK2) << 2) |   \
  127.  ((linewidth & MASK4) << 3)    )
  128.  
  129. #define TXTSLOTS 32
  130.  
  131. /*
  132.  *Define the equivalences for the various attributes
  133.  */
  134. /* gxmode: copy and xor are the only ones maintained */
  135. #define XPROF_GXCOPY        0
  136. #define XPROF_GXXOR        1
  137. /* All other gxmodes are treated as follows:
  138.  * one operand gxmode => copy */
  139. #define XPROF_GXCLEAR        XPROF_GXCOPY
  140. #define XPROF_GXNOOP        XPROF_GXCOPY
  141. #define XPROF_GXINVERT        XPROF_GXCOPY
  142. #define XPROF_GXCOPYINVERTED    XPROF_GXCOPY
  143. #define XPROF_GXSET        XPROF_GXCOPY
  144. /* two operand gxmode => xor */
  145. #define XPROF_GXAND        XPROF_GXXOR
  146. #define XPROF_GXANDREVERSE    XPROF_GXXOR
  147. #define XPROF_GXANDINVERTED    XPROF_GXXOR
  148. #define XPROF_GXOR        XPROF_GXXOR
  149. #define XPROF_GXNOR        XPROF_GXXOR
  150. #define XPROF_GXEQUIV        XPROF_GXXOR
  151. #define XPROF_GXORREVERSE    XPROF_GXXOR
  152. #define XPROF_GXORINVERTED    XPROF_GXXOR
  153. #define XPROF_GXNAND        XPROF_GXXOR
  154.  
  155. /* linestyle: LineSolid and LineOnOffDash are the only ones maintained */
  156. #define XPROF_LINESOLID         0
  157. #define XPROF_LINEDOUBLEDASH     1
  158. #define XPROF_LINEONOFFDASH    XPROF_LINEDOUBLEDASH
  159.  
  160. /* fillstyle: FillSolid and FillOpaqueStippled are the only ones maintained */
  161. #define XPROF_FILLSOLID         0
  162. #define XPROF_FILLOPAQUESTIPPLED 1
  163. #define XPROF_FILLSTIPPLED     XPROF_FILLOPAQUESTIPPLED
  164. #define XPROF_FILLTILED         XPROF_FILLOPAQUESTIPPLED
  165.  
  166. typedef struct _XprofGCvalues {
  167.     long   id;        /* ID assigned by X window server */
  168.     int    function;    /* What boolean function ? */
  169.     int    line_width;    /* Actual width of drawn line */
  170.     int    line_style;
  171.     int    fill_style;
  172.     struct _FontVal *fontval;
  173.     struct _XprofGCvalues *next;
  174. } XprofGCvalues;
  175.  
  176. typedef struct _FontVal {
  177.     long id;
  178.     char *fontname;
  179.     struct _FontVal *next;
  180. } FontVal;
  181.  
  182. typedef struct _Xattributes {
  183.     XprofGCvalues *gcval;    /* pointer to graphics values */
  184.     long      bytes;
  185.     float      size;
  186.     unsigned int  width, height;
  187.     int          angle1, angle2; /* for arcs */
  188. } Xattributes;
  189.  
  190. typedef struct _ProfileStats {    /* These are all kept in milliseconds */
  191.     double net_time;    /* Time spent by the message in the network */
  192.     double cpu_time;    /* Cpu time at the display-server */
  193.     double total_time;
  194.     Valid  cpu_valid;    /* Is the cpu_time data valid ? */
  195. } ProfileStats;
  196.  
  197. #endif    /* #ifndef _PROFILE_H_ */
  198.  
  199.